package com.wsm.kotlintest.adapter

import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.fragment.app.FragmentPagerAdapter
import com.wsm.kotlintest.fragment.BaseFragment
import com.wsm.kotlintest.fragment.DataFragment

/**
 * Created by 王家宝 on 2018/7/25.
 * TEL:18241150668
 * MAIL:639586819@qq.com
 */
class MainViewPagerAdapter(fm: FragmentManager) : FragmentPagerAdapter(fm) {

    var dataList: List<DataFragment>? = null

    override fun getItem(position: Int): Fragment {
        return dataList?.get(position)!!
    }

    override fun getCount(): Int {
        return dataList?.size ?: 0
    }

    override fun getPageTitle(position: Int): CharSequence? {
        return "第${position + 1}页"
    }

}